<template>
  <table class="table table-bordered table-stripped">
    <!-- 表格标题区域 -->
    <thead>
      <tr>
        <!-- <th>#</th>
        <th>商品名称</th>
        <th>价格</th>
        <th>标签</th>
        <th>操作</th> -->
        <slot name="header"></slot>
      </tr>
    </thead>
    <!-- 表格主体区域 -->
    <tbody>
      <tr v-for="(item, index) in goodList" :key="index">
        <!-- <td>{{ item.id }}</td>
        <td>{{ item.goods_name }}</td>
        <td>¥ {{ item.goods_price }}</td>
        <td>{{ item.tags[0] + " " + item.tags[1] }}</td>
        <td><button class="btn btn-danger btn-sm">删除</button></td> -->
        <slot name="body" :data="item" :index="index"></slot>
      </tr>
    </tbody>
    <tfoot>
      <tr v-show="goodList.length === 0">
        <td colspan="5">没有数据咯~</td>
      </tr>
    </tfoot>
  </table>
</template>

<script>
export default {
  props: {
    goodList: {
      type: Array,
      default: () => [],
    },
  },
};
</script>

<style lang="less" scoped>
tfoot {
  tr {
    text-align: center;
  }
}
</style>